//
//  CanTextView.m
//  ProjectCan
//
//  Created by LiBenCan on 17/7/21.
//  Copyright © 2017年 LiBenCan. All rights reserved.
//

#import "CanTextView.h"

@interface CanTextView ()

@end

@implementation CanTextView//动态行高TextView


-(void)configTextView
{
    self.layer.cornerRadius = 4;
    self.layer.masksToBounds = YES;
    self.layer.borderWidth = 1;
    self.font = [UIFont systemFontOfSize:14];
    self.layer.borderColor = [[[UIColor lightGrayColor] colorWithAlphaComponent:0.4] CGColor];
    self.textContainerInset = UIEdgeInsetsMake(10,0,0,0);

}
//
//- (float) heightForTextView: (UITextView *)textView WithText: (NSString *) strText{
//    CGSize constraint = CGSizeMake(textView.contentSize.width , CGFLOAT_MAX);
//    CGRect size = [strText boundingRectWithSize:constraint
//                                        options:(NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading)
//                                     attributes:@{NSFontAttributeName: [UIFont systemFontOfSize:14]}
//                                        context:nil];
//    float textHeight = size.size.height + 22.0;
//    
//    if (self.heightblock) {
//        self.heightblock(textHeight);
//    }
//    return textHeight;
//}
//
//- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
//{
//    CGRect frame = textView.frame;
//    float  height = [ self heightForTextView:textView WithText:textView.text];
//    frame.size.height = height;
//    [UIView animateWithDuration:0.5 animations:^{
//        
//        textView.frame = frame;
//        
//    } completion:nil];
//    
//    return YES;
//}
@end
